﻿using Game.NetWork;

namespace Game
{
    public class SubsystemNPCPackage : IPackage
    {
        public bool isYSlivingNet;

        public byte ID => 113;

        public Client To { get; set; }

        public Client Except { get; set; }

        public Client From { get; set; }

        public ClientState MinNeedState => ClientState.Playing;

        public SubsystemNPCPackage()
        {
        }

        public SubsystemNPCPackage(bool YS)
        {
            isYSlivingNet = YS;
        }

        public void WriteData(PackageStreamWriter writer)
        {
            writer.Write(isYSlivingNet);
        }

        public void ReadData(PackageStreamReader reader)
        {
            isYSlivingNet = reader.ReadBoolean();
        }

        public void Handle(ProjectNet projectNet, NetNode netNode, bool isServer)
        {
            SubsystemNPCBehavior subsystemNPCBehavior = projectNet.FindSubsystem<SubsystemNPCBehavior>();
            subsystemNPCBehavior.isYSLiving = isYSlivingNet;
        }
    }
}